using System;
using System.Data;
using System.Collections.Generic;
using System.Data.SqlClient;
using Core;

namespace DataAccess
{
    public class tbIntroduce : Popular
    {

        public int IntroduceId { get; set; }
        public string Title { get; set; }
        public string ContenIntroduce { get; set; }
        public int OrgID { get; set; }
        public bool IsIntro { get; set; }

        Common<tbIntroduce> cm = new Common<tbIntroduce>();
        public bool Insert(Popular b)
        {
            return cm.Insert(b as tbIntroduce, "sp_tbIntroduce_Insert");
        }
        public bool Update(Popular b)
        {
            return cm.UpDate(b as tbIntroduce, "sp_tbIntroduce_Update");
        }
        public bool Delete(object b)
        {
            return cm.Delete(b, "sp_tbIntroduce_Delete");
        }
        public IDataReader Select_ID(object b)
        {
            return cm.Select_ID(b, "sp_tbIntroduce_SelectByID");
        }
        public tbIntroduce GetIntroOrg(object b)
        {
            try
            {
                return CBO.FillObject<tbIntroduce>(DataProvider.Instance.ExecuteReader("[sp_tbIntroduce_SelectByOrgIntroID]", b));
            }
            catch
            {
                return null;
            }
        }
        public List<tbIntroduce> GetIntroByOrg(object b)
        {
            try
            {
                return CBO.FillCollection<tbIntroduce>(DataProvider.Instance.ExecuteReader("[sp_tbIntroduce_SelectByOrg]", b));
            }
            catch
            {
                return new List<tbIntroduce>();
            }
        }
        public IDataReader Select_Name(object b)
        {
            return cm.Select_Name(b, "sp_tbIntroduce_SelectByName");
        }
        public IDataReader SelectAll()
        {
            return cm.Select_All("sp_tbIntroduce_SelectAll");
        }
    }
}